﻿using System;

namespace helloworld.DI
{
    public interface IFoo { };
    public interface IBaz { };
    public interface IGux
    {
        //IFoo Foo { get; }
        //IBar Bar { get; }
        //IBaz Baz { get; }
    }


    public class Foo : Disposable, IFoo, IFooBar { }
    public class Bar : Disposable, IBar, IFooBar { }
    public class Baz : Disposable, IBaz { }
    public class Gux : IGux
    {
        //public IFoo Foo { get; private set; }
        //public IBar Bar { get; private set; }
        //public IBaz Baz { get; private set; }

        //public Gux(IFoo foo)
        //{
        //    Console.WriteLine("Gux(IFoo)");
        //}

        //public Gux(IFoo foo, IBar bar)
        //{
        //    Console.WriteLine("Gux(IFoo,IBar)");
        //}

        //public Gux(IFoo foo, IBar bar, IBaz baz)
        //{
        //    this.Foo = foo;
        //    this.Bar = bar;
        //    this.Baz = baz;
        //    Console.WriteLine("Gux(IFoo,IBar,IBaz)");
        //}

        //==============

        //public Gux(IFoo foo, IBar bar)
        //{
        //    Console.WriteLine("Gux(IFoo,IBar)");
        //}

        //public Gux(IBar bar, IBaz baz)
        //{
        //    Console.WriteLine("Gux(IBar,IBaz)");
        //}
    }

    public class Disposable : IDisposable
    {
        public void Dispose()
        {
            Console.WriteLine($@"{this.GetType()}.Dispose");
        }
    }

    //====================
    public interface IFooBar : IDisposable { }

    //===================

    public interface IFooBaz<T1, T2>
    {
        T1 Foo { get; }
        T2 Baz { get; }
    }

    public class FooBar : IFooBar
    {
        public void Dispose()
        {
            Console.WriteLine("FooBar.Dispose()");
        }

        ~FooBar()
        {
            Console.WriteLine("FooBar.Finalize()");
        }
    }

    //public class FooBaz<T1, T2> : IFooBaz<T1, T2>
    //{
    //    public T1 Foo { get; private set; }

    //    public T2 Baz { get; private set; }

    //    public FooBaz(T1 foo, T2 baz)
    //    {
    //        this.Foo = foo;
    //        this.Baz = baz;
    //    }
    //}
}
